<template>
  <div>
    <div v-show="true" class="huj">
      <div class="one">
        <div class="left">
          <h3 class="tit1">正在为您搜索附近代驾</h3>
          <p class="leixing">已为您呼叫附近的师傅,请耐心等待</p>
        </div>
        <button class="quxiao" @click="quxiao">取消呼叫</button>
      </div>
      <van-loading
        color="#1989fa"
        style="text-align: center; padding: 10px 0 20px 0"
      />
      <!-- <van-count-down :time="time" /> -->
      <p>{{ time }}</p>
      <div class="qingdeng">请您耐心等待</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      time: "10",
      times: "",
    };
  },
  methods: {
    quxiao() {
      this.$emit("Child", true);
    },
  },
  mounted() {
    this.times = setInterval(() => {
      this.time = this.time - 1;
    }, 1000);
    if (this.time == 0) {
      clearInterval(a);
    }
  },
  watch: {
    time(newv, oldv) {
      if (newv == 0) {
        clearInterval(this.times);
        this.$emit("Child", 11);
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.huj {
  width: 100%;
  .one {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    .left {
      padding: 5px;
      .tit1 {
        padding: 5px;
      }
      .leixing {
        color: rgb(138, 133, 128);
        font-size: 13px;
        padding: 5px;
      }
    }
    .quxiao {
      width: 70px;
      height: 25px;
      font-size: 12px;
      text-align: center;
      line-height: 25px;
    }
  }
}
p {
  text-align: center;
  padding: 10px 0;
  color: red;
}
.qingdeng {
  padding: 10px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
}
</style>